cmake_minimum_required(VERSION 3.16)
project(cpp_call_python LANGUAGES CXX)

#include(qt.cmake)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if(CMAKE_VERSION VERSION_LESS "3.7.0")
    set(CMAKE_INCLUDE_CURRENT_DIR ON)
endif()

message("cmake_module_path: " ${CMAKE_MODULE_PATH})

find_package(Qt5 COMPONENTS Widgets Core Gui Sql Xml REQUIRED)
set(Python3_ROOT_DIR "C:/Users/Jyang/AppData/Local/Programs/Python")
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)

#find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
#find_package(Qt${QT_VERSION_MAJOR}
#    COMPONENTS
#        Core
#        Gui
#        Widgets
#)
#qt_standard_project_setup()

set(PROJECT_SOURCES
    main.cpp
    cpp_call_python.ui
    cpp_call_python.h
    cpp_call_python.cpp
)

include_directories(${Python3_INCLUDE_DIRS})
link_directories(${Python3_LIBRARY_DIRS})

#include_directories("./include")
#link_directories("./libs")

#aux_source_directory("./libs" PYTHON_LIB)
#aux_source_directory("./include" PYTHON_HEADER)

add_executable(cpp_call_python ${PYTHON_HEADER} ${PROJECT_SOURCES})

set_target_properties(cpp_call_python
    PROPERTIES
        WIN32_EXECUTABLE TRUE
)

target_link_libraries(cpp_call_python
    PUBLIC
        Qt::Core
        Qt::Gui
        Qt::Widgets
        ${PYTHON_LIB}
)
